﻿// Decompiled with JetBrains decompiler
// Type: UnityEngine.Light
// Assembly: UnityEngine.CoreModule, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: E6AE6B5A-2752-4B07-9528-C8B77C62CE79
// Assembly location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.dll
// XML documentation location: C:\Users\windys\Unity\2021.3.39f1c1\Editor\Data\Managed\UnityEngine\UnityEngine.CoreModule.xml

using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using UnityEngine.Bindings;
using UnityEngine.Rendering;

#nullable disable
namespace UnityEngine
{
  /// <summary>
  ///   <para>Script interface for.</para>
  /// </summary>
  [RequireComponent(typeof (Transform))]
  [NativeHeader("Runtime/Camera/Light.h")]
  [RequireComponent(typeof (Transform))]
  [NativeHeader("Runtime/Export/Graphics/Light.bindings.h")]
  public sealed class Light : Behaviour
  {
    private int m_BakedIndex;

    /// <summary>
    ///   <para>The type of the light.</para>
    /// </summary>
    [NativeProperty("LightType")]
    public extern LightType type { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>This property describes the shape of the spot light. Only Scriptable Render Pipelines use this property; the built-in renderer does not support it.</para>
    /// </summary>
    [NativeProperty("LightShape")]
    public extern LightShape shape { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>The angle of the light's spotlight cone in degrees.</para>
    /// </summary>
    public extern float spotAngle { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>The angle of the light's spotlight inner cone in degrees.</para>
    /// </summary>
    public extern float innerSpotAngle { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>The color of the light.</para>
    /// </summary>
    public Color color
    {
      get
      {
        Color ret;
        this.get_color_Injected(out ret);
        return ret;
      }
      set => this.set_color_Injected(ref value);
    }

    /// <summary>
    ///   <para>
    ///     The color temperature of the light.
    ///     Correlated Color Temperature (abbreviated as CCT) is multiplied with the color filter when calculating the final color of a light source. The color temperature of the electromagnetic radiation emitted from an ideal black body is defined as its surface temperature in Kelvin. White is 6500K according to the D65 standard. A candle light is 1800K and a soft warm light bulb is 2700K.
    ///     If you want to use colorTemperature, GraphicsSettings.lightsUseLinearIntensity and Light.useColorTemperature has to be enabled.
    ///     Additional resources: GraphicsSettings.lightsUseLinearIntensity, GraphicsSettings.useColorTemperature.
    ///   </para>
    /// </summary>
    public extern float colorTemperature { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Set to true to use the color temperature.</para>
    /// </summary>
    public extern bool useColorTemperature { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>The Intensity of a light is multiplied with the Light color.</para>
    /// </summary>
    public extern float intensity { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>The multiplier that defines the strength of the bounce lighting.</para>
    /// </summary>
    public extern float bounceIntensity { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Set to true to override light bounding sphere for culling.</para>
    /// </summary>
    public extern bool useBoundingSphereOverride { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Bounding sphere used to override the regular light bounding sphere during culling.</para>
    /// </summary>
    public Vector4 boundingSphereOverride
    {
      get
      {
        Vector4 ret;
        this.get_boundingSphereOverride_Injected(out ret);
        return ret;
      }
      set => this.set_boundingSphereOverride_Injected(ref value);
    }

    /// <summary>
    ///   <para>Whether to cull shadows for this Light when the Light is outside of the view frustum.</para>
    /// </summary>
    public extern bool useViewFrustumForShadowCasterCull { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>The custom resolution of the shadow map.</para>
    /// </summary>
    public extern int shadowCustomResolution { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Shadow mapping constant bias.</para>
    /// </summary>
    public extern float shadowBias { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Shadow mapping normal-based bias.</para>
    /// </summary>
    public extern float shadowNormalBias { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Near plane value to use for shadow frustums.</para>
    /// </summary>
    public extern float shadowNearPlane { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Set to true to enable custom matrix for culling during shadows.</para>
    /// </summary>
    public extern bool useShadowMatrixOverride { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Matrix that overrides the regular light projection matrix during shadow culling. Unity uses this matrix if you set Light.useShadowMatrixOverride to true.</para>
    /// </summary>
    public Matrix4x4 shadowMatrixOverride
    {
      get
      {
        Matrix4x4 ret;
        this.get_shadowMatrixOverride_Injected(out ret);
        return ret;
      }
      set => this.set_shadowMatrixOverride_Injected(ref value);
    }

    /// <summary>
    ///   <para>The range of the light.</para>
    /// </summary>
    public extern float range { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>The to use for this light.</para>
    /// </summary>
    public extern Flare flare { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>This property describes the output of the last Global Illumination bake.</para>
    /// </summary>
    public LightBakingOutput bakingOutput
    {
      get
      {
        LightBakingOutput ret;
        this.get_bakingOutput_Injected(out ret);
        return ret;
      }
      set => this.set_bakingOutput_Injected(ref value);
    }

    /// <summary>
    ///   <para>This is used to light certain objects in the Scene selectively.</para>
    /// </summary>
    public extern int cullingMask { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Determines which rendering LayerMask this Light affects.</para>
    /// </summary>
    public extern int renderingLayerMask { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Allows you to override the global Shadowmask Mode per light. Only use this with render pipelines that can handle per light Shadowmask modes. Incompatible with the legacy renderers.</para>
    /// </summary>
    public extern LightShadowCasterMode lightShadowCasterMode { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Controls the amount of artificial softening applied to the edges of shadows cast by the Point or Spot light (Editor only).</para>
    /// </summary>
    public extern float shadowRadius { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Controls the amount of artificial softening applied to the edges of shadows cast by directional lights (Editor only).</para>
    /// </summary>
    public extern float shadowAngle { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Revert all light parameters to default.</para>
    /// </summary>
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern void Reset();

    /// <summary>
    ///   <para>How this light casts shadows</para>
    /// </summary>
    public extern LightShadows shadows { [NativeMethod("GetShadowType"), MethodImpl(MethodImplOptions.InternalCall)] get; [FreeFunction("Light_Bindings::SetShadowType", HasExplicitThis = true, ThrowsException = true), MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Strength of light's shadows.</para>
    /// </summary>
    public extern float shadowStrength { [MethodImpl(MethodImplOptions.InternalCall)] get; [FreeFunction("Light_Bindings::SetShadowStrength", HasExplicitThis = true), MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>The resolution of the shadow map.</para>
    /// </summary>
    public extern LightShadowResolution shadowResolution { [MethodImpl(MethodImplOptions.InternalCall)] get; [FreeFunction("Light_Bindings::SetShadowResolution", HasExplicitThis = true, ThrowsException = true), MethodImpl(MethodImplOptions.InternalCall)] set; }

    [EditorBrowsable(EditorBrowsableState.Never)]
    [Obsolete("Shadow softness is removed in Unity 5.0+", true)]
    public float shadowSoftness
    {
      get => 4f;
      set
      {
      }
    }

    [Obsolete("Shadow softness is removed in Unity 5.0+", true)]
    [EditorBrowsable(EditorBrowsableState.Never)]
    public float shadowSoftnessFade
    {
      get => 1f;
      set
      {
      }
    }

    /// <summary>
    ///   <para>Per-light, per-layer shadow culling distances. Directional lights only. </para>
    /// </summary>
    public extern float[] layerShadowCullDistances { [FreeFunction("Light_Bindings::GetLayerShadowCullDistances", HasExplicitThis = true, ThrowsException = false), MethodImpl(MethodImplOptions.InternalCall)] get; [FreeFunction("Light_Bindings::SetLayerShadowCullDistances", HasExplicitThis = true, ThrowsException = true), MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>The size of a directional light's cookie.</para>
    /// </summary>
    public extern float cookieSize { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>The cookie texture projected by the light.</para>
    /// </summary>
    public extern Texture cookie { [MethodImpl(MethodImplOptions.InternalCall)] get; [MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>How to render the light.</para>
    /// </summary>
    public extern LightRenderMode renderMode { [MethodImpl(MethodImplOptions.InternalCall)] get; [FreeFunction("Light_Bindings::SetRenderMode", HasExplicitThis = true, ThrowsException = true), MethodImpl(MethodImplOptions.InternalCall)] set; }

    [EditorBrowsable(EditorBrowsableState.Never)]
    [Obsolete("warning bakedIndex has been removed please use bakingOutput.isBaked instead.", true)]
    public int bakedIndex
    {
      get => this.m_BakedIndex;
      set => this.m_BakedIndex = value;
    }

    /// <summary>
    ///   <para>The size of the area light (Editor only).</para>
    /// </summary>
    public Vector2 areaSize
    {
      get
      {
        Vector2 ret;
        this.get_areaSize_Injected(out ret);
        return ret;
      }
      set => this.set_areaSize_Injected(ref value);
    }

    /// <summary>
    ///   <para>This property describes what part of a light's contribution can be baked (Editor only).</para>
    /// </summary>
    public extern LightmapBakeType lightmapBakeType { [NativeMethod("GetBakeType"), MethodImpl(MethodImplOptions.InternalCall)] get; [NativeMethod("SetBakeType"), MethodImpl(MethodImplOptions.InternalCall)] set; }

    /// <summary>
    ///   <para>Sets a light dirty to notify the light baking backends to update their internal light representation (Editor only).</para>
    /// </summary>
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern void SetLightDirty();

    /// <summary>
    ///   <para>Add a command buffer to be executed at a specified place.</para>
    /// </summary>
    /// <param name="evt">When to execute the command buffer during rendering.</param>
    /// <param name="buffer">The buffer to execute.</param>
    /// <param name="shadowPassMask">A mask specifying which shadow passes to execute the buffer for.</param>
    public void AddCommandBuffer(LightEvent evt, CommandBuffer buffer)
    {
      this.AddCommandBuffer(evt, buffer, ShadowMapPass.All);
    }

    /// <summary>
    ///   <para>Add a command buffer to be executed at a specified place.</para>
    /// </summary>
    /// <param name="evt">When to execute the command buffer during rendering.</param>
    /// <param name="buffer">The buffer to execute.</param>
    /// <param name="shadowPassMask">A mask specifying which shadow passes to execute the buffer for.</param>
    [FreeFunction("Light_Bindings::AddCommandBuffer", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern void AddCommandBuffer(
      LightEvent evt,
      CommandBuffer buffer,
      ShadowMapPass shadowPassMask);

    /// <summary>
    ///   <para>Adds a command buffer to the GPU's async compute queues and executes that command buffer when graphics processing reaches a given point.</para>
    /// </summary>
    /// <param name="evt">The point during the graphics processing at which this command buffer should commence on the GPU.</param>
    /// <param name="buffer">The buffer to execute.</param>
    /// <param name="queueType">The desired async compute queue type to execute the buffer on.</param>
    /// <param name="shadowPassMask">A mask specifying which shadow passes to execute the buffer for.</param>
    public void AddCommandBufferAsync(
      LightEvent evt,
      CommandBuffer buffer,
      ComputeQueueType queueType)
    {
      this.AddCommandBufferAsync(evt, buffer, ShadowMapPass.All, queueType);
    }

    /// <summary>
    ///   <para>Adds a command buffer to the GPU's async compute queues and executes that command buffer when graphics processing reaches a given point.</para>
    /// </summary>
    /// <param name="evt">The point during the graphics processing at which this command buffer should commence on the GPU.</param>
    /// <param name="buffer">The buffer to execute.</param>
    /// <param name="queueType">The desired async compute queue type to execute the buffer on.</param>
    /// <param name="shadowPassMask">A mask specifying which shadow passes to execute the buffer for.</param>
    [FreeFunction("Light_Bindings::AddCommandBufferAsync", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern void AddCommandBufferAsync(
      LightEvent evt,
      CommandBuffer buffer,
      ShadowMapPass shadowPassMask,
      ComputeQueueType queueType);

    /// <summary>
    ///   <para>Remove command buffer from execution at a specified place.</para>
    /// </summary>
    /// <param name="evt">When to execute the command buffer during rendering.</param>
    /// <param name="buffer">The buffer to execute.</param>
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern void RemoveCommandBuffer(LightEvent evt, CommandBuffer buffer);

    /// <summary>
    ///   <para>Remove command buffers from execution at a specified place.</para>
    /// </summary>
    /// <param name="evt">When to execute the command buffer during rendering.</param>
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern void RemoveCommandBuffers(LightEvent evt);

    /// <summary>
    ///   <para>Remove all command buffers set on this light.</para>
    /// </summary>
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern void RemoveAllCommandBuffers();

    /// <summary>
    ///   <para>Get command buffers to be executed at a specified place.</para>
    /// </summary>
    /// <param name="evt">When to execute the command buffer during rendering.</param>
    /// <returns>
    ///   <para>Array of command buffers.</para>
    /// </returns>
    [FreeFunction("Light_Bindings::GetCommandBuffers", HasExplicitThis = true)]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public extern CommandBuffer[] GetCommandBuffers(LightEvent evt);

    /// <summary>
    ///   <para>Number of command buffers set up on this light (Read Only).</para>
    /// </summary>
    public extern int commandBufferCount { [MethodImpl(MethodImplOptions.InternalCall)] get; }

    [Obsolete("Use QualitySettings.pixelLightCount instead.")]
    public static int pixelLightCount
    {
      get => QualitySettings.pixelLightCount;
      set => QualitySettings.pixelLightCount = value;
    }

    [FreeFunction("Light_Bindings::GetLights")]
    [MethodImpl(MethodImplOptions.InternalCall)]
    public static extern Light[] GetLights(LightType type, int layer);

    [Obsolete("light.shadowConstantBias was removed, use light.shadowBias", true)]
    public float shadowConstantBias
    {
      get => 0.0f;
      set
      {
      }
    }

    [Obsolete("light.shadowObjectSizeBias was removed, use light.shadowBias", true)]
    public float shadowObjectSizeBias
    {
      get => 0.0f;
      set
      {
      }
    }

    [Obsolete("light.attenuate was removed; all lights always attenuate now", true)]
    public bool attenuate
    {
      get => true;
      set
      {
      }
    }

    [Obsolete("Light.lightmappingMode has been deprecated. Use Light.lightmapBakeType instead (UnityUpgradable) -> lightmapBakeType", true)]
    public LightmappingMode lightmappingMode
    {
      get => LightmappingMode.Realtime;
      set
      {
      }
    }

    /// <summary>
    ///   <para>Is the light contribution already stored in lightmaps and/or lightprobes (Read Only). Obsolete; replaced by Light-lightmapBakeType.</para>
    /// </summary>
    [Obsolete("Light.isBaked is no longer supported. Use Light.bakingOutput.isBaked (and other members of Light.bakingOutput) instead.", false)]
    public bool isBaked => this.bakingOutput.isBaked;

    [Obsolete("Light.alreadyLightmapped is no longer supported. Use Light.bakingOutput instead. Allowing to describe mixed light on top of realtime and baked ones.", false)]
    public bool alreadyLightmapped
    {
      get => this.bakingOutput.isBaked;
      set
      {
        this.bakingOutput = new LightBakingOutput()
        {
          probeOcclusionLightIndex = -1,
          occlusionMaskChannel = -1,
          lightmapBakeType = value ? LightmapBakeType.Baked : LightmapBakeType.Realtime,
          isBaked = value
        };
      }
    }

    [SpecialName]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void get_color_Injected(out Color ret);

    [SpecialName]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void set_color_Injected(ref Color value);

    [SpecialName]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void get_boundingSphereOverride_Injected(out Vector4 ret);

    [SpecialName]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void set_boundingSphereOverride_Injected(ref Vector4 value);

    [SpecialName]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void get_shadowMatrixOverride_Injected(out Matrix4x4 ret);

    [SpecialName]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void set_shadowMatrixOverride_Injected(ref Matrix4x4 value);

    [SpecialName]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void get_bakingOutput_Injected(out LightBakingOutput ret);

    [SpecialName]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void set_bakingOutput_Injected(ref LightBakingOutput value);

    [SpecialName]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void get_areaSize_Injected(out Vector2 ret);

    [SpecialName]
    [MethodImpl(MethodImplOptions.InternalCall)]
    private extern void set_areaSize_Injected(ref Vector2 value);
  }
}
